<%@page import="org.blog.controller.UserController"%>
<%@page import="org.blog.beans.User"%>
<%@page import="org.blog.messages.LoginMessage"%>
<%@ page errorPage="../jsp/exceptionHandler.jsp" %>

	
	
	
		<%if(UserController.isLogged(session)) {%>
		
			Witaj, <%= UserController.getUser(session).getLogin() %>!<br/>
			
			<a href = "Login?do=logout"><input type="button" value="Wyloguj"></a>
			
		<%} else { %>
	
			<% LoginMessage lm = (LoginMessage)request.getAttribute("messageL"); 
					   if(lm == null) lm = new LoginMessage();
						
			%>
			<form name = "login" method = "post" onsubmit="return loginValidation(); " action = "Login">
				
				login: <br/>
				<input type="text" name = "login"> <br/>
				haslo: <br/>
				<input type="password" name = "password"> <br/>
				<button type = "submit">zaloguj</button>
				<div id = "error" class = "error"> <%= lm.getMessage() %> </div>
				<br><a href = "Registration">Zarejestruj sie</a>
			</form>
			<%} %>
	